//
//  UIButton+Extension.swift
//  SinaBlog
//
//  Created by 李超 on 16/3/25.
//  Copyright © 2016年 lichao. All rights reserved.
//

import UIKit
//对UIButton进行拓展
extension UIButton{
    //便利构造函数
    convenience init(titlt:String,imageName:String,bgImageName:String,target:AnyObject?,action:Selector,event:UIControlEvents){
        self.init()
        self.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named: bgImageName), forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named: "\(bgImageName)_highlighted"), forState: UIControlState.Highlighted)
        self.setTitle(titlt, forState: UIControlState.Normal)
        self.addTarget(target, action: action, forControlEvents: event)
        self.setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
       self.titleLabel?.font = UIFont.systemFontOfSize(12)
       
    }
    //便利构造函数
    convenience init(titlt:String,target:AnyObject?,action:Selector,event:UIControlEvents){
        self.init()
        self.setTitle(titlt, forState: UIControlState.Normal)
        self.addTarget(target, action: action, forControlEvents: event)
        self.setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
        self.titleLabel?.font = UIFont.systemFontOfSize(12)
        
    }

    
    
}